package com.ruoyi.ldzlsc.event;

import org.springframework.context.ApplicationEvent;

/**
 * 派工成功创建事件
 * <p>
 * 用于模块间解耦，通知下游模块（如质检、看板）进行响应。
 *
 * @author ldzl
 * @date 2024-07-31
 */
public class DispatchCreatedEvent extends ApplicationEvent {

    /** 派工指令ID */
    private final Long dispatchId;
    /** 工序任务ID */
    private final Long workOrderTaskId;
    /** 领料单ID */
    private final Long materialIssueId;
    /** 质检人员ID */
    private final Long qcPersonId;
    /** 操作人 */
    private final String createdBy;

    /**
     * 创建一个新的DispatchCreatedEvent.
     *
     * @param source          事件源对象, 通常是 this
     * @param dispatchId      派工指令ID
     * @param workOrderTaskId 工序任务ID
     * @param materialIssueId 领料单ID (可能为null，如果没有领料)
     * @param qcPersonId      质检人员ID (可能为null)
     * @param createdBy       操作人
     */
    public DispatchCreatedEvent(Object source, Long dispatchId, Long workOrderTaskId, Long materialIssueId, Long qcPersonId, String createdBy) {
        super(source);
        this.dispatchId = dispatchId;
        this.workOrderTaskId = workOrderTaskId;
        this.materialIssueId = materialIssueId;
        this.qcPersonId = qcPersonId;
        this.createdBy = createdBy;
    }

    // Getters
    public Long getDispatchId() {
        return dispatchId;
    }

    public Long getWorkOrderTaskId() {
        return workOrderTaskId;
    }

    public Long getMaterialIssueId() {
        return materialIssueId;
    }

    public Long getQcPersonId() {
        return qcPersonId;
    }

    public String getCreatedBy() {
        return createdBy;
    }
} 